table.insert(itemActions,
	function(item, action)
		-- MAGIC smallcharms
		-- see: dir .. "readme.txt" for information regarding these variables
		local priority = 7
		local identify = true
		local dump = true

		if not (item.quality == ItemQuality.Magic and item.baseItem.code == "cm1") then
			return false
		elseif action == aPICK and (not item.flags.Identified or isGoodSmallCharm(item)) then
			return priority
		elseif action == aIDENT then
			return identify
		elseif action == aSELL and item.flags.Identified and not isGoodSmallCharm(item) then
			return true
		elseif action == aDUMP and item.flags.Identified and not isGoodSmallCharm(item) then
			return dump
		end

		return false
	end
)

function isGoodSmallCharm(item)
	-- note: ar, maxdam, psd, mp, hp, str, dex, and mf are all assigned values
	-- so you can add custom scs in the return
	-- do not try to compare other variables (bools) with numbers
	-- feel free to change the lower prefix/suffix bounds
	local prefix = false
	local ar, maxdam, psd, mp, gf = 0, 0, 0, 0, 0
	local suffix = false
	local hp, str, dex, mf, fhr, frw = 0, 0, 0, 0, false, false
	local affix = false

	if hasRes(item, 3, 4) or hasRes(item, 6, 1) then -- 3-4% allres 6-8% single resists->affix
		affix = true
  end
		

	for i=0, item.mods:size() - 1 do
		if item.mods[i].Stat.Type == StatType.ToHit then
			if item.mods[i].Value >= 12 then -- 20+ar->prefix
				prefix = true
			end
			ar = item.mods[i].Value
		elseif item.mods[i].Stat.Type == StatType.MaxDamage then
			if item.mods[i].Value >= 2 then -- 2+maxdam->prefix
				affix = true
			end
			maxdam = item.mods[i].Value
		elseif item.mods[i].Stat.Type == StatType.PoisonMinDamage then
				if item.mods[i].Min >= 100 then -- 175+psd->affix
					affix = true
				elseif item.mods[i].Min >= 50 then -- 100+psd->prefix
					prefix = true
				end
			psd = item.mods[i].Min
		elseif item.mods[i].Stat.Type == StatType.MaxMana then
			if item.mods[i].Value >= 10 then -- 13+mp->prefix
				affix = true
			end
			mp = item.mods[i].Value
		elseif item.mods[i].Stat.Type == StatType.MaxLife then
			if item.mods[i].Value >= 12 then -- 16+hp->suffix
				prefix = true
			end
			hp = item.mods[i].Value
		elseif item.mods[i].Stat.Type == StatType.Strength then
			if item.mods[i].Value == 2 then -- 2str->suffix
				suffix = true
			end
			str = item.mods[i].Value
		elseif item.mods[i].Stat.Type == StatType.Dexterity then
			if item.mods[i].Value == 2 then -- 2dex->suffix
				suffix = true
			end
			dex = item.mods[i].Value
		elseif item.mods[i].Stat.Type == StatType.GoldFind then
			if item.mods[i].Value >= 9 then -- 9+gf->affix
				suffix = true
			end
			gf = item.mods[i].Value
		elseif item.mods[i].Stat.Type == StatType.FasterHitRecovery then
			fhr = true -- fhr->suffix
			suffix = true
		elseif item.mods[i].Stat.Type == StatType.FasterMoveVelocity then
			frw = true -- frw->suffix
			suffix = true
		elseif item.mods[i].Stat.Type == StatType.MagicFind then
			if item.mods[i].Value >= 5 then -- 6mf->suffix
				affix = true
			end
			mf = item.mods[i].Value
		end
	end

	return (
			prefix or
			suffix or
			affix or
			hasRes(item, 5, 1) or 
			hasRes(item, 9, 4) or
			gf >= 8 -- 8-10% goldfind
			
			)
end